import QtQuick 2.4
import QtQuick.Controls 1.3

ApplicationWindow {
    title: qsTr("Hello World")
    width: 400
    height: 240
    visible: true
    Canvas{
        width: 400; height: 240
        anchors.centerIn: parent

        onPaint: {
            var ctx = getContext("2d");
            ctx.lineWidth = 2;
            ctx.strokeStyle = "red";
            ctx.fillStyle = "blue";
            ctx.beginPath();
            ctx.rect(100, 80, 120, 80);
            ctx.fill();
            ctx.stroke();
        }
    }
}
